package com.yz.antlr.VisitorDemo;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yanzhao
 * @version 1.0
 * TODO
 * @date 2022/4/2 18:00
 */

public class Menu extends Component {

    List<Component> menuComponents = new ArrayList<Component>();
    String name;
    String description;

    public Menu(String name, String description) {
        this.name = name;
        this.description = description;
    }
    @Override
    public void add(Component menuComponent) {
        menuComponents.add(menuComponent);
    }
    @Override
    public void remove(Component menuComponent) {
        menuComponents.remove(menuComponent);
    }
    @Override
    public Component getChild(int i) {
        return menuComponents.get(i);
    }

    @Override
    public String getName() {
        return name;
    }

    public String getDescription() {
        return description;
    }

    public List<Component> getMenuComponents() {
        return menuComponents;
    }

    @Override
    public void accept(Visitor visitor) {
        visitor.visit(this);
    }

}
